package com.ruoyi.schoolSys.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.schoolSys.model.vo.LeaveMsgVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.schoolSys.mapper.LeaveMsgMapper;
import com.ruoyi.schoolSys.domain.LeaveMsg;
import com.ruoyi.schoolSys.service.ILeaveMsgService;

/**
 * 留言板Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-02-19
 */
@Service
public class LeaveMsgServiceImpl implements ILeaveMsgService 
{
    @Autowired
    private LeaveMsgMapper leaveMsgMapper;

    /**
     * 查询留言板
     * 
     * @param id 留言板主键
     * @return 留言板
     */
    @Override
    public LeaveMsgVo selectLeaveMsgById(Long id)
    {
        return leaveMsgMapper.selectLeaveMsgById(id);
    }

    /**
     * 查询留言板列表
     * 
     * @param leaveMsg 留言板
     * @return 留言板
     */
    @Override
    public List<LeaveMsgVo> selectLeaveMsgList(LeaveMsg leaveMsg)
    {
        return leaveMsgMapper.selectLeaveMsgList(leaveMsg);
    }

    /**
     * 新增留言板
     * 
     * @param leaveMsg 留言板
     * @return 结果
     */
    @Override
    public int insertLeaveMsg(LeaveMsg leaveMsg)
    {
        leaveMsg.setCreateTime(DateUtils.getNowDate());
        return leaveMsgMapper.insertLeaveMsg(leaveMsg);
    }

    /**
     * 修改留言板
     * 
     * @param leaveMsg 留言板
     * @return 结果
     */
    @Override
    public int updateLeaveMsg(LeaveMsg leaveMsg)
    {
        return leaveMsgMapper.updateLeaveMsg(leaveMsg);
    }

    /**
     * 批量删除留言板
     * 
     * @param ids 需要删除的留言板主键
     * @return 结果
     */
    @Override
    public int deleteLeaveMsgByIds(Long[] ids)
    {
        return leaveMsgMapper.deleteLeaveMsgByIds(ids);
    }

    /**
     * 删除留言板信息
     * 
     * @param id 留言板主键
     * @return 结果
     */
    @Override
    public int deleteLeaveMsgById(Long id)
    {
        return leaveMsgMapper.deleteLeaveMsgById(id);
    }
}
